<?php
/**
* Elgg bookmarks save action
*
* @package GolfScore
*/
$golf_course_id = get_input('golf_course_id');
$course_name = get_input('course_name');
$par_total = get_input('par_total');

$gold_tee_name = get_input('gold_tee_name');
$gold_course_rating = get_input('gold_course_rating');
$gold_course_slope = get_input('gold_course_slope');
$gold_total = get_input('gold_total');
$blue_tee_name = get_input('blue_tee_name');
$blue_course_rating = get_input('blue_course_rating');
$blue_course_slope = get_input('blue_course_slope');
$blue_total = get_input('blue_total');
$white_tee_name = get_input('white_tee_name');
$white_course_rating = get_input('white_course_rating');
$white_course_slope = get_input('white_course_slope');
$white_total = get_input('white_total');
$red_tee_name = get_input('red_tee_name');
$red_course_rating = get_input('red_course_rating');
$red_course_slope = get_input('red_course_slope');
$red_total = get_input('red_total');

$golf_course = new ElggGolfCourseItem();
$golf_course->golf_course_id = $golf_course_id;
$golf_course->course_name = $course_name;
$golf_course->par_total = $par_total;

$golf_course->gold_tee_name = $gold_tee_name;
$golf_course->gold_course_rating = $gold_course_rating;
$golf_course->gold_course_slope = $gold_course_slope;
$golf_course->gold_total = $gold_total;
$golf_course->blue_tee_name = $blue_tee_name;
$golf_course->blue_course_rating = $blue_course_rating;
$golf_course->blue_course_slope = $blue_course_slope;
$golf_course->blue_total = $blue_total;
$golf_course->white_tee_name = $white_tee_name;
$golf_course->white_course_rating = $white_course_rating;
$golf_course->white_course_slope = $white_course_slope;
$golf_course->white_total = $white_total;
$golf_course->red_tee_name = $red_tee_name;
$golf_course->red_course_rating = $red_course_rating;
$golf_course->red_course_slope = $red_course_slope;
$golf_course->red_total = $red_total;

save_golf_course($golf_course);

$error = array('error' => '0');
$error = json_encode($error);
print $error;